package com.micro.ai.auth.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.micro.ai.auth.entity.Tenant;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 租户Mapper接口
 * 
 * @author micro-ai
 * @since 0.0.1
 */
@Mapper
public interface TenantMapper extends BaseMapper<Tenant> {

    /**
     * 根据子域名查询租户
     * 
     * @param subdomain 子域名
     * @return 租户信息
     */
    @Select("SELECT * FROM tenants WHERE subdomain = #{subdomain} AND deleted_at IS NULL")
    Tenant selectBySubdomain(@Param("subdomain") String subdomain);
}

